using Microsoft.AspNetCore.Mvc;
using 后端服务.Services;

namespace 后端服务.Controllers
{
    /// <summary>
    /// 版本控制器，提供应用程序版本信息
    /// </summary>
    [ApiController]
    [Route("api/[controller]")]
    public class VersionController : ControllerBase
    {
        private readonly VersionService _versionService;
    
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="versionService">版本服务</param>
        public VersionController(VersionService versionService)
        {
            _versionService = versionService;
        }

        /// <summary>
        /// 获取当前应用程序版本
        /// </summary>
        /// <returns>包含版本号的响应</returns>
        [HttpGet]
        public IActionResult GetVersion()
        {
            var version = _versionService.GetCurrentVersion();
            return Ok(new { version });
        }
    }
}